{% extends "base_generic.html" %}
{% block script %}
<script type="text/javascript">
  function generateUrl(name) {
    var sanitizedName = name;
    sanitizedName = sanitizedName.replace(/ el /gi, ' ');
    sanitizedName = sanitizedName.replace(/ la /gi, ' ');
    sanitizedName = sanitizedName.replace(/ los /gi, ' ');
    sanitizedName = sanitizedName.replace(/ las /gi, ' ');
    sanitizedName = sanitizedName.replace(/ de /gi, ' ');
    sanitizedName = sanitizedName.replace(/ del /gi, ' ');
    sanitizedName = sanitizedName.replace(/ temporada /gi, ' ');
    sanitizedName = string_to_slug(sanitizedName);
    sanitizedName = sanitizedName.replace(/--/gi, '-');
    sanitizedName = sanitizedName.replace(/---/gi, '-');
    sanitizedName = sanitizedName.replace(/----/gi, '-');
    $("#slug").val(sanitizedName);
  }
  $(window).load(
    function() {
      $(':input:visible:enabled:first').focus();
    });
</script>
{% endblock %}
{% block content %}
        <h1>Team</h1>
        <form action="/admin/teams/{{ key }}/save/" method="post">
        
        <div class="line">
          <div class="field">
            <label>Name:</label>
            <input id="name" name="name" type="text" size="65" value="{{ team.name }}" onblur="generateUrl(this.value);" />
          </div>
          <div class="field">
            <label>Ciudad:</label>
            <input id="city" name="city" type="text" size="50" value="{{ team.city }}" />
          </div>
        </div>
        <div class="line">
          <div class="field">
            <label>Slug:</label>
            <input id="slug" name="slug" type="text" size="50" value="{{ team.slug }}" />
          </div>
          <div class="field">
            <label>Genre - Number:</label>
            <input id="genrenumber" name="genrenumber" type="text" size="10" value="{% if genrenumber %}{{ genrenumber }}{% else %}el{% endif %}" />
          </div>
           <div class="field">
             <label>Country:</label>
             <select name="country" id="country">
              {% for country in countries %}
              <option value="{{ country.name }}">{{ country.name }}</option>
              {% endfor %}
             </select>
           </div>
           <div class="field">
              <label><input type="checkbox" id="theStadium" name="theStadium" {% if team.theStadium %}checked="checked" {% endif %}/> el</label>
            </div>
             <div class="field">
              <label>Estadio:</label>
              <input type="text" name="stadium" id="stadium" value="{{ team.stadium }}" />
            </div>
          </div>
        <input type="hidden" name="codenum" id="codenum" value="{{ filekey }}" />
        <input type="submit" value="Guardar" id="save" name="save" name="save" /><br class="clear" />
      </form>
      <br class="clear" />

{% endblock %}
      